package com.hmall.common.util;

import org.springframework.stereotype.Component;

@Component
public class ThreadLocalUtil {
    private static ThreadLocal<Object> thread = new ThreadLocal<>();
    public static void set(Object o){
        thread.set(o);
    }
    public static Object get(){
        Object o = thread.get();
        if (o == null){
            throw new RuntimeException("-----------value is empty ");
        }
        return o;
    }
    public static void remove(){
        thread.remove();
    }
}
